var imgIndex = 1; // 当前页图片索引
var pageIndex = 0; // 页索引
var mySwiper;
var total = "";
var currentPage = 1
getAlbum();


function getAlbum() {
    var newSwiper = new Swiper(".album-swiper", {
            // autoplay: true,
            // pagination: {
            //     el: '.pagination-wrap',
            // },
        })
        // 切换结束时执行
    newSwiper.on("slideChangeTransitionEnd", function() {
        currentPage = newSwiper.activeIndex + 1
        imgIndex = newSwiper.activeIndex + 1;
        console.log(imgIndex);
        total = $(".gallery div").length;
        $(".pagination-wrap").html(currentPage + "/" + total);
        $(".gallery div").each(function(index, value) {
            if (index == imgIndex) {
                $(".gallery div").removeClass("active").eq(index - 1).addClass("active");
            }
        })
    })
}

$(".gallery div").each(function() {
        total = $(".gallery div").length;
        $(".pagination-wrap").html(currentPage + "/" + total);
        $(this).click(function() {
            var dataIndex = this.getAttribute("data-index");
            currentPage = this.getAttribute("data-index");
            $(".pagination-wrap").html(currentPage + "/" + total);
            $(".gallery div").removeClass("active").eq($(this).index()).addClass("active");
        })
    })
    //评论切换
function commentOrder(obj) {
    let status = $(".comment-head-r").attr("data-status");
    console.log(status)
    if (status == "new") {
        $("#comment_change").html("热门评论");
        $(".comment-head-r span").html("按热度")
        $(".comment-head-r").attr("data-status", "hot");
        //    status=hot;
    } else {
        $("#comment_change").html("最新评论");
        $(".comment-head-r span").html("按时间");
        $(".comment-head-r").attr("data-status", "new");
        //    status=new;
    }
}